package forum

class User {

    String firstName
    String lastName
    String email
    String password
    String userName


    static hasMany = [post: Post]


    static constraints = {
        firstName(blank: false)
        lastName(blank: false)
        userName(blank: false)
        password(unique: true, length: 8..20,
                validator:
                        { val, obj ->
                            if (val?.equalsIgnoreCase(obj.firstName) ||val?.equalsIgnoreCase(obj.lastName)
                                ||val?.equalsIgnoreCase(obj.userName)) {
                                return false
                            }
                        })

        email(email: false)
    }
}
